package netty.bio;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.util.UUID;

/**
 * @author cyt
 * @create 2020-11-04 10:44
 */
public class BioClient {
    public static void main(String[] args) throws IOException {
        Socket client = new Socket("127.0.0.1", 9999);
        OutputStream outputStream = client.getOutputStream();

        for (int i = 0; i < 4; i++) {
            new Thread(() -> {
                String substring = UUID.randomUUID().toString().substring(0, 4);
                try {
                    outputStream.write(substring.getBytes());
                } catch (IOException e) {
                    e.printStackTrace();
                } finally {
                }
                System.out.println("写入完毕 - 》》》 ");
            }, "Thread" + String.valueOf(i)).start();
        }
    }
}
